package testng.station;

import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;

import train.Station;

public class TestStation {

	Station station;

	@Test(groups = "StationTests", dataProvider = "DataDrivenTest")
	public void testIsBetween(int n, int lower, int upper, boolean expected) {
		System.out.println("Received " + n + " " + lower + "-" + upper
				+ " expected: " + expected);
		Assert.assertEquals(expected, station.isBetween(n, lower, upper));
	}

	@DataProvider(name = "DataDrivenTest")
	public Object[][] dataProvider() {
		int lower = 5;
		int upper = 10;
		return new Object[][] { { lower + 1, lower, upper, true },
				{ upper - 1, lower, upper, true },
				{ upper, lower, upper, true },
				{ (lower + upper) / 2, lower, upper, true },
				{ lower, lower, upper, true },
				{ lower - 1, lower, upper, false },
				{ upper + 1, lower, upper, false } };
	}

	@BeforeTest(alwaysRun = true)
	public void beforeTest() {
		station = new Station();
	}

}
